<?php
// +----------------------------------------------------------------------
// | [ 简单 高效 卓越 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016 http://www.lingyun.net All rights reserved.
// +----------------------------------------------------------------------
// | Author: jry <598821125@qq.com>
// +----------------------------------------------------------------------
namespace Admin\Model;

use Common\Model\ModelModel;

class ToutiaoModel extends ModelModel
{
	/**
     * 数据库表名
     * @author jry <598821125@qq.com>
     */
    protected $tableName = 'admin_toutiao';
	
	/**
     * 自动验证规则
     * @author jry <598821125@qq.com>
     */
    protected $_validate = array(
        //验证品牌名称
        array('name', 'require', '头条名称不能为空', self::MUST_VALIDATE, 'regex', self::MODEL_BOTH),
		//验证品牌名称
        // array('img_id', 'require', '请上传导航图', self::EXISTS_VALIDATE, 'regex', self::MODEL_BOTH),
        //验证品牌名称
        array('name', '', '头条名称已存在', self::MUST_VALIDATE, 'unique', self::MODEL_BOTH),

    );


	public function chaxun(){
		
		return $select =$this->order('id desc')->select();//查询数据
		
		
	}
	public function shanchu(){

		return $result=$this->where('id='.$_GET['id'])->delete();
	
	}

	
	public function xiugai(){
				
		return	$result =$this->where('id='.$_GET['id'])->select();//获取修改数据
				
	}	
	
	public function tianjia($datas){

		return  $result = $this->add($datas);
		
	}	
}